const options = import.meta.glob(`../option/**/**`)
const apis = import.meta.glob(`../api/**/**`)

function getApi(apiPath) {
    let api=apis[apiPath];
    if (!api){
        console.error("api is not exist ",apiPath)
        throw Error(apiPath +" api is not exist")
    }
    return api;
}

function getOption(optionPath) {
    let option=options[optionPath];
    if (!option){
        console.error("optionPath is not exist ",optionPath)
        throw Error(optionPath +" option is not exist")
    }
    return option;
}

const startCurdConfig = {
    getApi,
    getOption
};

export default startCurdConfig